package com.zzk.www.domain.enums;


import com.fasterxml.jackson.annotation.JsonFormat;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum MessageStatus {

    ready(0, "就绪"),

    sent(1, "已发送"),

    received(2, "已接收"),

    cancel(3, "待撤销"),

    canceled(4, "已撤销"),

    ;

    private int code;
    private String description;

    MessageStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static MessageStatus getByCode(int code) {
        for (MessageStatus s : MessageStatus.values()) {
            if (s.getCode() == code) {
                return s;
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
